#include "communication/usart/usart_base.h"

void Usart_Base::MergeData()
{
    uint16_t len = 4*(float_num-1)+3;
    for(uint8_t i = 0;i<float_num;i++)
    {
        for(uint8_t j = 0;j<4;j++)
        {
            tx_buff[4*i + j] = float_data[i].data_u8[j];
        }
    }

    tx_buff[len+1]=0x00;
    tx_buff[len+2]=0x00;
    tx_buff[len+3]=0x80;
    tx_buff[len+4]=0x7f;
    all_len = len+5;

    delete float_data;
}

void Usart_Base::SetFloatData(float * _data,uint8_t len)
{
    float_data = new change_type_union[len];
		float_num = len;
    for(uint8_t i=0;i<len;i++)
    {
        float_data[i].change_float = _data[i];
    }
}

